Skip to content

fix: preserve custom lead agent names during reprovisioning#283

Open
aramirez087 wants to merge 5 commits intoabhi1693:masterfrom
aramirez087:fix/preserve-lead-agent-name
Open

fix: preserve custom lead agent names during reprovisioning#283
aramirez087 wants to merge 5 commits intoabhi1693:masterfrom
aramirez087:fix/preserve-lead-agent-name

Conversation

@aramirez087
Copy link

Summary

  • Lead agent names set via PATCH (e.g. "Ferris", "Sentinel") were silently reverted to "Lead Agent" on every lifecycle reconciliation
  • Root cause: ensure_board_lead_agent() always fell back to the static default name when config_options.agent_name was None (which it is during automated reprovisions)
  • Fix: prefer the agent's existing DB name over the static default

The bug

# Before: always resets to "Lead Agent" during reprovisioning
desired_name = config_options.agent_name or self.lead_agent_name(board)

Every gateway restart, heartbeat config patch, or lifecycle reconciliation would overwrite custom names. In practice this meant renamed agents reverted within minutes.

The fix

# After: preserves existing custom name
default_name = self.lead_agent_name(board)
desired_name = config_options.agent_name or existing.name or default_name

Fallback chain: explicit config name > existing DB name > "Lead Agent" (new agents only).

Test plan

  • make backend-test — 469 passed, 0 failed
  • Rename a lead agent via PATCH, trigger a reprovision, verify name persists
  • Create a new board lead — verify it still defaults to "Lead Agent"

🤖 Generated with Claude Code

`ensure_board_lead_agent()` unconditionally reset the agent name to
"Lead Agent" on every lifecycle reconciliation because `config_options
.agent_name` is None during automated reprovisions, falling through to
the static default.

This meant any custom name set via PATCH (e.g. "Ferris", "Sentinel")
was silently overwritten on the next gateway restart or heartbeat
config patch — sometimes within minutes.

Fix: prefer the agent's existing name over the static default. The
fallback chain is now: explicit config name → existing DB name →
"Lead Agent" (only for brand-new agents with no name).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a provisioning reconciliation bug in the OpenClaw DB provisioning service where board lead agent display names set via PATCH were being overwritten back to the static default during reprovisioning.

Changes:

  • Updates ensure_board_lead_agent() to prefer the existing persisted lead agent name when no explicit agent_name override is provided.
  • Keeps the static default lead agent name as the fallback for newly created lead agents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants